package cn.edu.scau.cmi.zhonghaozheng.adapter;

import java.util.ArrayList;
import java.util.List;

public class AdapterOfObject implements SortStudent{

	@Override
	public List sortStudent(List<Student> student) {
		SortUtil sortmothod = new SortUtil();
		List<Integer> studentIDList = new ArrayList<Integer>();
		List<Student> newStudents = new ArrayList<Student>();
		for(int i = 0 ; i < student.size() ; i++) {
			 studentIDList.add(student.get(i).getID());
		}
		sortmothod.sortInt(studentIDList);
		for(int i = 0 ; i < studentIDList.size() ; i++) {
			for(int j = 0 ; j < student.size() ; j++) {
				if(studentIDList.get(i) == student.get(j).getID()) {
					newStudents.add(student.get(j));
				}
			}
		}
		return newStudents;
	}

}
